package algorithm;

/**
 * 
 */

/**
 * @author Tor Bittmann
 * 
 */

public abstract class CountingAlgorithm {
	private int runningCount;
	private double trueCount;

	/**
	 * requires runningCount != null
	 * 
	 * @param runningCount
	 *            ensures this.getRunningCount() returns runningCount
	 */
	public void setRunningCount(int runningCount) {
		this.runningCount = runningCount;
	}

	/**
	 * requires trueCount != null
	 * 
	 * @param trueCount
	 *            ensures: this.getTrueCount() returns trueCount
	 */
	public void setTrueCount(double trueCount) {
		this.trueCount = trueCount;
	}

	/**
	 * requires nothing
	 * 
	 * @return the value of runningCount ensures:nothing
	 */
	public int getRunningCount() {
		return runningCount;
	}

	/**
	 * requires nothin
	 * 
	 * @return the value of trueCount ensures:nothing
	 */
	public double getTrueCount() {
		return trueCount;
	}

	/**
	 * @requires value != null
	 * @param myCard
	 *            Adjusts the value of the runningCard based on myCard ensures:
	 *            this.getRunningCount returns value + (this.getRunningCount
	 *            @pre)
	 */
	public void updateRunningCount(int value) {
		runningCount += value;

	}

	/**
	 * requires decksLeft != null
	 * 
	 * @param myCard
	 *            Adjusts the value of the trueCount based on mycard and the
	 *            number of decks left ensures: this.getTrueCount() returns
	 *            this.runningCount/decksLeft
	 */
	public void updateTrueCount(int decksLeft) {
		trueCount = (double) runningCount / decksLeft;
	}

}
